import {PageContainer, ProColumns, ProTable} from '@ant-design/pro-components';
import {Button, Card} from 'antd';
import React from 'react';
import ChangeAdd from "@/pages/Devops/Change/changeAdd";


const Index: React.FC = () => {
  const [openChange, setOpenChange] = React.useState(false);


  const changeColumn : ProColumns<Record<string, any>, "text">[] =[
    {
      dataIndex:'name',
      title:'变更名称'
    },
    {
      dataIndex:'branch',
      title:'分支'
    },
    {
      dataIndex:'owner',
      title:'负责人'
    },
    {
      dataIndex:'createdAt',
      title:'创建时间'
    },
    {
      dataIndex:'modifiedAt',
      title:'更新时间'
    },
    {
      dataIndex:'changeStatus',
      title:'变更状态'
    },
  ]

  const  dataSource = [
    {name:'曾经沧海难为水',branch:'feature/20250407_moderation',owner:'张三',createdAt:'202504-07 15:31:56',modifiedAt:'202504-07 15:31:56'},
  ]

  return (
    <PageContainer
      title={false}
      // tabBarExtraContent={<Button type={'primary'} onClick={()=>setOpenChange(true)}>新建变更</Button>}
    >
      <ProTable
        search={false}
        columns={changeColumn}
        dataSource={dataSource}
        toolbar={{
          title: '变更列表',
          // 操作按钮
          actions: [
            <Button type={"primary"} onClick={()=>setOpenChange(true)}>新建变更</Button>
          ],
        }}
      />

      <ChangeAdd OnOpenChange={setOpenChange} Open={openChange} />

    </PageContainer>
  );
};
export default Index;
